/**
  ******************************************************************************
  * @file    Bsp/i2cdevice.h 
  * @author  zlf
  * @version V1.0.0
  * @date    2016-04-06
  * @brief   Header for i2cdevice module
  ******************************************************************************
  */

/* Define to prevent recursive inclusion -------------------------------------*/

#ifndef __I2CDEVICE_H
#define __I2CDEVICE_H

/* Includes ------------------------------------------------------------------*/
	#include "main.h"

/* Exported constants --------------------------------------------------------*/

//the FRAM RCC clock at APB1 part
#define I2C_RCC_APB1_CLOCK  		( RCC_APB1Periph_I2C1 )

//the Two Interface
#define I2C_USED   					( I2C1 )
#define I2C_GPIO     				( GPIOB )
#define I2C_SCL_PIN      			( GPIO_Pin_6 )
#define I2C_SDA_PIN      			( GPIO_Pin_7 )

/* Exported macro ------------------------------------------------------------*/


/* Exported types ------------------------------------------------------------*/


/* Exported functions --------------------------------------------------------*/

//extern function for FRAM31256
//extern void Fram31256_I2C_HW_Init( void );

//Pulbic functions of FRAM31256
//extern ErrorStatus Fram31256_Status( void );
//extern void Fram31256_Write_Byte(u16 WordAddress, u8 ByteVal);
//extern void Fram31256_Write_Word(u16 WordAddress, u16 WordVal);
//extern u8 Fram31256_Read_Byte(u16 WordAddress);
//extern u16 Fram31256_Read_Word(u16 WordAddress);

//Pulbic functions of fm24c104
extern void I2C_HW_Init( void );
extern ErrorStatus Fm24c104_Status_old( void );
extern void Fram_Write_Byte_old(u16 WordAddress, u8 ByteVal);
extern void Fram_Write_Word_old(u16 WordAddress, u16 WordVal);
extern u8 Fram_Read_Byte_old(u16 WordAddress);
extern u16 Fram_Read_Word_old(u16 WordAddress);

// RTC 
extern void RTC_Time_Init( void );
extern void RTC_Write_Time(void);
extern void RTC_Read_Time(void);
extern void RTC_Write_Time_Date(u8 date);
extern void RTC_Write_Time_Hour(u8 hour);
extern void RTC_Write_Time_Minu(u8 minutes);
extern void RTC_Write_Time_Sec(u8 seconds);




#endif /* __I2C_DEVICE_H */

/************************ (C) COPYRIGHT Yuanzhi ThinkRob ***** END OF FILE ****/






